<h2>Order #<?php echo $order->id;?></h2>
<p><b>Total: </b> <?php echo $order->transaction->amount;?></p>
<p><b>Date Placed: </b> <?php echo gmdate('m/d/Y', $order->transaction->date_created);?></p>
<p><b>Shipping Date: </b> <?php echo gmdate('m/d/Y', $order->transaction->date_finalized);?></p>
<?php if($order->transaction->date_finalized > strtotime('now')):?>
<p><b>Status: </b> <?php echo 'Waiting to Ship';?> </p>
<?php else:?>
<p><b>Status: </b> <?php echo 'Shipped';?> </p>
<?php endif;?>
<h4>Ordered Items</h4>
<table>
<tr>
<th>Item</th>
<th>Unit Price</th>
<th>Quantity</th>
<th>Price</th>
</tr>
<?php foreach($order->order_items->find_all() as $order_item):?>
<?php $inventory_item = $order_item->inventory_item; ?>
<?php $item = $inventory_item->item; ?>
<tr>
<td><?php echo HTML::anchor('item/item/sitem/'.$item->id, $item->name); ?></td>
<td><?php echo $item->price; ?></td>
<td><?php echo $order_item->quantity;?> </td>
<td><?php echo '$'.$item->price*$order_item->quantity;?></td>
</tr>
<?php endforeach;?>
</table>

<?php echo Html::anchor('admin/users/orders/'.$order->user->id, 'Back to Orders');?>